<?php
	session_start();	
?>

<?php
	if( $_SESSION["admin"] != "" )
	{
?>

<a href="index.php?com=category"><b>List category</b></a> | <a href="index.php?com=category&func=add"><b>Add new category</b></a>
<br />
<?php
	include_once("process/category.php");	
	$list = new category();	
  $pager = new PS_Pagination($list->_connection, $list->GetListPaging(), 15, 5, "", "?com=category");
	
	$rs = $pager->paginate();

	$table = '<table width="100%" style="font-size:10pt;">
				<tr>
					<td align="center" colspan="9" height="50"><b style="font-size:12pt; color:Blue;">List category</b></td>
				</tr>
				<tr bgcolor="#996699" style=" font-weight:bold;">						
					<td style="padding:4px;">Admin title</td>
                    <td style="padding:4px;">parent</td>
                    <td style="padding:4px;">left</td>
                    <td style="padding:4px;">right</td>
                    <td style="padding:4px;">status</td>
                    <td style="padding:4px;">main_image</td>
                    <!--<td style="padding:4px;">short_description</td>
                    <td style="padding:4px;">description</td>
                    <td style="padding:4px;">main_menu</td>
                    <td style="padding:4px;">template_id</td>
                    <td style="padding:4px;">keywords</td>
                    <td style="padding:4px;">tag_description</td>-->
					<td style="padding:4px;" align="center" width="70px" colspan="2"></td>
				</tr>';
        while($list = mysql_fetch_assoc($rs))
	{
		$table .= '	<tr bgcolor="#FFFFFF"  onMouseOver="this.bgColor = '."'#C0C0C0'".'" onMouseOut ="this.bgColor = '."'#FFFFFF'".'">
						
						<td style="padding:4px;">
							'.$list['admin_title'].'
						</td>
                        	
						<td style="padding:4px;">
							'.$list['parent'].'
						</td>
                        	<td style="padding:4px;">
							'.$list['left'].'
						</td>
                        <td style="padding:4px;">
							'.$list['right'].'
						</td>
                        	
						<td style="padding:4px;">
							'.$list['status'].'
						</td>
                        	<td style="padding:4px;">
							'.$list['main_image'].'
						</td>
                        <!--<td style="padding:4px;">
							'.$list['short_description'].'
						</td>
                        	
						<td style="padding:4px;">
							'.$list['description'].'
						</td>
                        	<td style="padding:4px;">
							'.$list['main_menu'].'
						</td>
                        <td style="padding:4px;">
							'.$list['template_id'].'
						</td>
                        	
						<td style="padding:4px;">
							'.$list['keywords'].'
						</td>
                        	<td style="padding:4px;">
							'.$list['tag_description'].'
						</td>-->
						<td align="center">
							<a style="color:#0033FF;" href="index.php?com=category&func=update&id='.$list['category_id'].'">
								Update
							</a>
						</td>
						<td align="center">
							<a onClick="'."return confirm('Do you want to delete this category ?')".'"  style="color:#0033FF" href="index.php?com=category&func=delete&id='.$list['category_id'].'">
								Delete
							</a>
						</td>
					</tr>';
            }
	//endforeach;
	$table .= '</table>';
	echo $table.'<br />';
	echo $pager->renderFullNav();
  }
   else
	{
		echo "<meta http-equiv='refresh' content='0; url=login.php' />";
	}
?>